import time
import unittest

from HTMLTestRunner.HTMLTestRunner import HTMLTestRunner


from setting import TESTCASE_DIR,TESTCASE_SEARCH_PATTERN,TITLE,DESCRIPTION
from utils.session import Session

loader = unittest.TestLoader()
suite = loader.discover(start_dir=TESTCASE_DIR, pattern=TESTCASE_SEARCH_PATTERN)

strtime = time.strftime("%Y%m%d%H%M%S")
name = "report\\report"+strtime+".html"

with open(file=name,mode="w",encoding="utf-8") as f:
    runner = HTMLTestRunner(stream=f,verbosity=2,title=TITLE,description=DESCRIPTION)
    runner.run(suite)